package com.javastudy;

import java.util.Scanner;
import org.junit.Test;

public class test_1 {
	@Test
	public  void  SK(){
		
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入单价、数量、实付");
		double price  = scanner.nextDouble();
		double number = scanner.nextDouble();
		double payment = scanner.nextDouble();
		double cost  = price * number ;
		if (cost > payment || payment <= 0 || number <= 0) {
			System.out.println("您输入的数值不正确，请确认后重新输入！");
		}else if (cost >= 500){
			cost *=0.8;
			System.out.println("您一共消费"+String.format("%.2f",cost)+"元,总价超过500，享受八折优惠，找零"+String.format("%.2f",(payment-cost)));
		}else {
			System.out.println("您一共消费"+String.format("%.2f",cost)+"元,找零"+String.format("%.2f",(payment-cost))+"元");
		}
		
	}
}
